package com.gagakuai.demo.importSelector;

import com.gagakuai.demo.beanFactoryPostProccess.CompoentConfig;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.util.List;

/*
 * @program: settement
 * @description: 测试
 * @author: houhong
 * @create: 2022-11-12 10:11
 */
public class MainTest {

    public static void main(String[] args) throws Exception {


        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ImportConfig.class);
        List<BeanFactoryPostProcessor> beanFactoryPostProcessors = context.getBeanFactoryPostProcessors();
        System.out.println("========beanFacotryPostProceeesors==========");
        for (BeanFactoryPostProcessor beanFactoryPostProcessor : beanFactoryPostProcessors) {
            System.out.println(beanFactoryPostProcessor);
        }

        DefaultListableBeanFactory beanFactory = context.getDefaultListableBeanFactory();
        List<BeanPostProcessor> processors = beanFactory.getBeanPostProcessors();

        System.out.println("========beanPostProceeesors==========");
        for (BeanPostProcessor processor : processors) {
            System.out.println(processor);
        }
    }
}